package com.spring2;

import com.spring2.pojo.Person;
import com.spring2.pojo.User;
import com.spring2.service.UserService;
import com.spring2.service.impl.UserServiceImpl;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SpringDemo {
    public static void main(String[] args) {
        ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("application-an.xml");
        Person person = ctx.getBean(Person.class);
        System.out.println(person);
        ctx.close();
    }

    private static void demo1() {
        ApplicationContext ctx = new ClassPathXmlApplicationContext("application-an.xml");
        UserService userService = ctx.getBean(UserServiceImpl.class);
        User user = userService.getById(1);
        System.out.println(user);
    }
}
